package com.teacher.mobile.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.teacher.common.CommonResult;
import com.teacher.pojo.dto.healthDevice.HealthDeviceAddDto;
import com.teacher.pojo.dto.healthDevice.HealthDeviceUpdateDto;
import com.teacher.service.IHealthDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jiangzhuohang
 * @since 2025-04-12
 */
@RestController
@RequestMapping("/healthDevice")
@Api(tags = "毕设设备界面（主界面）接口")
public class HealthDeviceController {

    @Autowired
    private IHealthDeviceService healthDeviceService;

    @ApiOperation("获取该用户设备列表")
    @GetMapping("/getHealthDeviceList")
    public CommonResult getHealthDevice(){
        return healthDeviceService.getHealthDevice();
    }

    

    @PostMapping("/addHealthDevice")
    @ApiOperation("添加设备 ")
    public CommonResult addHealthDevice(@RequestBody HealthDeviceAddDto dto) {
        return healthDeviceService.addHealthDevice(dto);
    }



    @DeleteMapping("/deleteHealthDeviceById")
    @ApiOperation("通过 id批量删除设备 ")
    public CommonResult deleteHealthDeviceById(@RequestBody List<Long> list) {
        return  healthDeviceService.deleteHealthDevice(list);
    }
    @PutMapping("/updateHealthDeviceById")
    @ApiOperation("通过id修改设备")
    public CommonResult updateHealthDeviceById(@RequestBody HealthDeviceUpdateDto updateDto) {
        return healthDeviceService.updateHealthDevice(updateDto);
    }
}

